package com.bjmashibing.system.huawei;


import com.bjmashibing.system.huawei.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by wangyuhong2267 on 18/9/12.
 */

public class Print_log {
    private final static Logger logger = LoggerFactory.getLogger(Print_log.class);
    String aaa;

    private static boolean aBooleanFlag = true;
    public static final String TAG = "wyh";
    public static void PrintLog() {

    }

    public  static  String[] GetMethodName(){
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        StackTraceElement targetElement = stackTrace[3];


        String class_method[] = new String[2];
        //获取类名
        class_method[0] = targetElement.getClassName();

        //获取当前方法名
        class_method[1]  = targetElement.getMethodName();
        return class_method;
    }

    public  static  String GetClassName(){
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        StackTraceElement targetElement = stackTrace[3];


        String str = "";
        //获取类名
        str = targetElement.getClassName();


        return str;
    }
    public  static  String GetFunName(){
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        StackTraceElement targetElement = stackTrace[3];


        String str = "";
        //获取类名
        str = targetElement.getMethodName();


        return str;
    }

    public static String getLineNumber(Exception e){
        StackTraceElement[] trace =e.getStackTrace();
        if(trace==null||trace.length==0) return "-1"; //
        Integer integer =trace[0].getLineNumber();
        return "LINE:"+integer ;
    }
    public static String getLineNumber2(Exception e){
        StackTraceElement[] trace =e.getStackTrace();
        if(trace==null||trace.length==0) return "-1"; //
        Integer integer =trace[0].getLineNumber();
        return "LINE:"+integer + " 0X"+Integer.toHexString(integer);
    }


    public  static void print_my_log2(String strLine,String strClassName,String strFunName,String strPara1,String strPara1Value,String strPara2,String strPara2Value){

        if(!aBooleanFlag){
            return;
        }

        logger.info(
                 strLine + "," +  strClassName + "," + strFunName
                + "," + strPara1 + "=" + strPara1Value
                + "," + strPara2 + "=" + strPara2Value
        );
    }
    public  static void print_my_log3(String strLine,String strFileName,String strFunName,String strPara1,String strPara1Value){


        if(!aBooleanFlag){
            return;
        }
        logger.info(
                strLine + "," +  strFileName + "," + strFunName
                        + "," + strPara1 + "=" + strPara1Value

        );
    }
    public  static void print_my_log5(String strLine,String strClassName,String strFunName,String strPara1,Boolean strPara1Value){


        if(!aBooleanFlag){
            return;
        }
        logger.info(
                strLine + "," +  strClassName + "," + strFunName
                        + "," + strPara1 + "=" + strPara1Value

        );
    }
    public  static void print_my_log4(String strLine,String strClassName,String strFunName){

        if(!aBooleanFlag){
            return;
        }

        logger.info(strLine + "," +  strClassName + "," + strFunName );
    }

}
